<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDistrictTable extends Migration
{
	/**
	 * @author 张健领
	 * Run the migrations.
	 * 城市三级联动表
	 * @return void
	 */
	public function up()
	{
		Schema::create('district', function (Blueprint $table) {
			$table->increments('id');
			$table->string('name');
			$table->unsignedTinyInteger('level')->default(0);
			$table->unsignedMediumInteger('upid')->default(0)->index();

			// 预留字段
			$table->string('field1')->nullable();
			$table->string('field2')->nullable();
			//系统字段
			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::dropIfExists('district');
	}
}
